   
<cfcomponent displayname="users" hint="I model a single users.">

	<cfset variables.NumericNull = 0 />
	<cfset variables.StringNull = "" />
	<cfset variables.DateNull = "#dateformat(now(),'short')# #timeformat(now(),'hh:mm:ss')#" />
	<cfset variables.BinaryNull = toBinary(toBase64("null")) />
		
	<cffunction name="init" access="public" returntype="users" output="false" displayname="users Constructor" hint="I initialize a users.">
	<cfargument name="userID" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="email" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="password" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="passwordSalt" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="firstName" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="lastName" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="userName" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="dtLastAccess" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="ipLastAccess" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="dtCreated" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="ipCreated" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="createdByID" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="dtModified" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="ipModified" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="modifiedByID" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="isActive" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="isSysAdmin" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="isAdmin" type="numeric" required="false" default="#variables.numericNull#"/>
	

		<cfscript>
			variables.instanceData = structnew();
			
			setuserID(arguments.userID);
			setemail(arguments.email);
			setpassword(arguments.password);
			setpasswordSalt(arguments.passwordSalt);
			setfirstName(arguments.firstName);
			setlastName(arguments.lastName);
			setuserName(arguments.userName);
			setdtLastAccess(arguments.dtLastAccess);
			setipLastAccess(arguments.ipLastAccess);
			setdtCreated(arguments.dtCreated);
			setipCreated(arguments.ipCreated);
			setcreatedByID(arguments.createdByID);
			setdtModified(arguments.dtModified);
			setipModified(arguments.ipModified);
			setmodifiedByID(arguments.modifiedByID);
			setisActive(arguments.isActive);
			setisSysAdmin(arguments.isSysAdmin);
			setisAdmin(arguments.isAdmin);
			setUsername(arguments.username);
		</cfscript>

		<cfreturn this />
	</cffunction>

	<cffunction name="setInstanceData" access="public" output="false" returntype="void">
		<cfargument name="data" type="struct" required="true"/>
		<cfset variables.instanceData = arguments.data/>
	</cffunction>

	<cffunction name="getInstanceData" access="public" output="false" returntype="struct">

		<cfreturn variables.instanceData/>
	</cffunction>
	
	<cffunction name="hasId" access="public" output="false" returntype="boolean" hint="I retrieve whether the users has an id (false indicates it's a new user)">

		<cfreturn structKeyExists(variables.instanceData,"userID")/>
	</cffunction>

	
	<cffunction name="getuserID" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.userID />
	</cffunction>	

	<cffunction name="setuserID" access="public" returntype="void" output="false">
		<cfargument name="userID" type="string" required="true">
		<cfset variables.instanceData.userID=arguments.userID />
	</cffunction>
	
	<cffunction name="getemail" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.email />
	</cffunction>	

	<cffunction name="setemail" access="public" returntype="void" output="false">
		<cfargument name="email" type="string" required="true">
		<cfset variables.instanceData.email=arguments.email />
	</cffunction>
	
	<cffunction name="getpassword" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.password />
	</cffunction>	

	<cffunction name="setpassword" access="public" returntype="void" output="false">
		<cfargument name="password" type="string" required="true">
		<cfset variables.instanceData.password=arguments.password />
	</cffunction>
	
	<cffunction name="getpasswordSalt" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.passwordSalt />
	</cffunction>	

	<cffunction name="setpasswordSalt" access="public" returntype="void" output="false">
		<cfargument name="passwordSalt" type="string" required="true">
		<cfset variables.instanceData.passwordSalt=arguments.passwordSalt />
	</cffunction>
	
	<cffunction name="getfirstName" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.firstName />
	</cffunction>	

	<cffunction name="setfirstName" access="public" returntype="void" output="false">
		<cfargument name="firstName" type="string" required="true">
		<cfset variables.instanceData.firstName=arguments.firstName />
	</cffunction>
	
	<cffunction name="getlastName" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.lastName />
	</cffunction>	

	<cffunction name="setlastName" access="public" returntype="void" output="false">
		<cfargument name="lastName" type="string" required="true">
		<cfset variables.instanceData.lastName=arguments.lastName />
	</cffunction>
	
	<cffunction name="getUserName" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.userName />
	</cffunction>	

	<cffunction name="setuserName" access="public" returntype="void" output="false">
		<cfargument name="userName" type="string" required="true">
		<cfset variables.instanceData.userName=arguments.userName />
	</cffunction>
	
	<cffunction name="getdtLastAccess" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.dtLastAccess />
	</cffunction>	

	<cffunction name="setdtLastAccess" access="public" returntype="void" output="false">
		<cfargument name="dtLastAccess" type="date" required="true">
		<cfset variables.instanceData.dtLastAccess=arguments.dtLastAccess />
	</cffunction>
	
	<cffunction name="getipLastAccess" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.ipLastAccess />
	</cffunction>	

	<cffunction name="setipLastAccess" access="public" returntype="void" output="false">
		<cfargument name="ipLastAccess" type="string" required="true">
		<cfset variables.instanceData.ipLastAccess=arguments.ipLastAccess />
	</cffunction>
	
	<cffunction name="getdtCreated" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.dtCreated />
	</cffunction>	

	<cffunction name="setdtCreated" access="public" returntype="void" output="false">
		<cfargument name="dtCreated" type="date" required="true">
		<cfset variables.instanceData.dtCreated=arguments.dtCreated />
	</cffunction>
	
	<cffunction name="getipCreated" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.ipCreated />
	</cffunction>	

	<cffunction name="setipCreated" access="public" returntype="void" output="false">
		<cfargument name="ipCreated" type="string" required="true">
		<cfset variables.instanceData.ipCreated=arguments.ipCreated />
	</cffunction>
	
	<cffunction name="getcreatedByID" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.createdByID />
	</cffunction>	

	<cffunction name="setcreatedByID" access="public" returntype="void" output="false">
		<cfargument name="createdByID" type="string" required="true">
		<cfset variables.instanceData.createdByID=arguments.createdByID />
	</cffunction>
	
	<cffunction name="getdtModified" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.dtModified />
	</cffunction>	

	<cffunction name="setdtModified" access="public" returntype="void" output="false">
		<cfargument name="dtModified" type="date" required="true">
		<cfset variables.instanceData.dtModified=arguments.dtModified />
	</cffunction>
	
	<cffunction name="getipModified" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.ipModified />
	</cffunction>	

	<cffunction name="setipModified" access="public" returntype="void" output="false">
		<cfargument name="ipModified" type="string" required="true">
		<cfset variables.instanceData.ipModified=arguments.ipModified />
	</cffunction>
	
	<cffunction name="getmodifiedByID" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.modifiedByID />
	</cffunction>	

	<cffunction name="setmodifiedByID" access="public" returntype="void" output="false">
		<cfargument name="modifiedByID" type="string" required="true">
		<cfset variables.instanceData.modifiedByID=arguments.modifiedByID />
	</cffunction>
	
	<cffunction name="getisActive" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.isActive />
	</cffunction>	

	<cffunction name="setisActive" access="public" returntype="void" output="false">
		<cfargument name="isActive" type="numeric" required="true">
		<cfset variables.instanceData.isActive=arguments.isActive />
	</cffunction>
	
	<cffunction name="getisSysAdmin" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.isSysAdmin />
	</cffunction>	

	<cffunction name="setisSysAdmin" access="public" returntype="void" output="false">
		<cfargument name="isSysAdmin" type="numeric" required="true">
		<cfset variables.instanceData.isSysAdmin=arguments.isSysAdmin />
	</cffunction>
	
	<cffunction name="getisAdmin" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.isAdmin />
	</cffunction>	

	<cffunction name="setisAdmin" access="public" returntype="void" output="false">
		<cfargument name="isAdmin" type="numeric" required="true">
		<cfset variables.instanceData.isAdmin=arguments.isAdmin />
	</cffunction>
	
</cfcomponent>
	

